package jdbc;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;

public class PreParedStmt2 {
	public static void main(String[] args) {

		try {
			Class.forName("oracle.jdbc.driver.OracleDriver");
			Connection con = DriverManager.getConnection(
					"jdbc:oracle:thin:@10.23.245:1521:orcl", "scott", "tiger");
			System.out.println("Driver Connected successfully.");

			PreparedStatement pstmt = con
					.prepareStatement("UPDATE myTable SET SALARY=? WHERE sro=?)");
			pstmt.setInt(2, 1);
			pstmt.setFloat(1, 25000f);

			pstmt.executeUpdate();

			System.out.println("Record successfully updated.");
			pstmt.close();
			con.close();

		} catch (Exception e) {
			System.out.println(e.toString());
		}
	}
}
